package com.jbl.te.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jbl.te.entity.College;
import com.jbl.te.entity.vo.CollegeQuery;
import com.jbl.te.mapper.CollegeMapper;
import com.jbl.te.service.CollegeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jbl
 * @since 2020-12-10
 */
@Service
public class CollegeServiceImpl extends ServiceImpl<CollegeMapper, College> implements CollegeService {

    @Override
    public void pageQuery(Page<College> pageParam, CollegeQuery collegeQuery) {
        if (collegeQuery == null) {
            this.page(pageParam, null);
            return;
        }
        String name = collegeQuery.getName();
        QueryWrapper<College> wrapper = new QueryWrapper<>();

        if (!StringUtils.isEmpty(name)) {
            wrapper.like("name", name);
        }

        this.page(pageParam, wrapper);
    }

}
